<!-- 问题列表 -->

<template>
  <div class="DetailQuestionnaire-MyQuestion full flex">
    <EasyScroll class="flex1" full>
      <WebShow labelPosition="top">
        <div
          v-for="item in one.questionList"
          :key="item.key"
          :id="`DetailQuestionnaire-MyQuestion-no-${item.no}`"
          class="DetailQuestionnaire-MyQuestion-item flex"
          :class="{ 'DetailQuestionnaire-MyQuestion-item-hover': item.no === MAP.hoverNo }"
          @mouseenter="toEnter(item)"
          @mouseleave="toLeave(item)"
        >
          <div class="flex0">{{ item.no }}.</div>
          <component :is="CORE.keyPre(item.type, 'My')" :obj="item" />
        </div>
      </WebShow>
    </EasyScroll>

    <RightNav class="eighth full" />
  </div>
</template>

<script>
// ============================== 导入依赖 ============================== //

import CORE from '@/CORE'

// ============================== 导出组件 ============================== //

export default {
  /**
   * 名称定义 (实际使用名称)
   */
  name: 'MyQuestion',

  /**
   * 混入列表 (配置选项合并)
   */
  mixins: [CORE.mixWeb()],

  /**
   * 组件导入 (Abc.vue + Abc/index.vue)
   */
  ...CORE.components(require.context('./', true, /vue$/)),

  /**
   * 本地方法 (轻量重要在前)
   */
  methods: {
    /**
     * 鼠标进入
     */
    toEnter(item) {
      this.MAP.hoverNo = item.no

      const nav = document.getElementById(`DetailQuestionnaire-MyQuestion-nav-${item.no}`)
      nav.scrollIntoView({ behavior: 'smooth', block: 'center' })
    },

    /**
     * 鼠标离开
     */
    toLeave() {
      this.MAP.hoverNo = 0
    },
  },
}
</script>

<style lang="scss">
@import './index.scss';
</style>
